<template>

  <template v-for="menu in menus">

    <el-sub-menu v-if="menu.menuType === 'M'" :key="menu.menuId" :index="'/'+parentPath+'/'+menu.path">

      <template #title>
        <el-icon>
          <component :is="menu.icon"></component>
        </el-icon>
        <span>{{ menu.menuName }}</span>
      </template>

      <SideMenu :parentPath="menu.path" :menus="menu.children"/>

    </el-sub-menu>

    <el-menu-item v-else :index="'/'+parentPath+'/'+menu.path">
      <el-icon>
        <component :is="menu.icon"></component>
      </el-icon>
      <span>{{ menu.menuName }}</span>
    </el-menu-item>

  </template>

</template>

<script setup lang="ts">

defineProps<{ parentPath: string, menus: any[] }>()

</script>

<style scoped>

</style>
